Skip to content

feat(isMobilePhone): Add Senegal (fr-SN) mobile phone validation#2678

Open
nihalar wants to merge 1 commit intovalidatorjs:masterfrom
nihalar:add-senegal-mobile-phone
Open

feat(isMobilePhone): Add Senegal (fr-SN) mobile phone validation#2678
nihalar wants to merge 1 commit intovalidatorjs:masterfrom
nihalar:add-senegal-mobile-phone

Conversation

@nihalar
Copy link
Copy Markdown

@nihalar nihalar commented Mar 7, 2026

Motivation

Addresses #1761 — adds mobile phone validation for a missing country.

Changes

  • Added fr-SN locale to isMobilePhone.js for Senegal mobile numbers
    • Country code: +221
    • Mobile numbers start with 7, followed by 0/5/6/7/8, then 7 digits
  • Added tests with valid and invalid Senegalese phone numbers
  • Updated README locale list

Test

All 317 tests pass locally with 100% statement coverage.

Add phone number validation for Senegal with locale fr-SN.
Senegal mobile numbers use country code +221 and start with
7 followed by 0, 5, 6, 7, or 8.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b1aea75) to head (6ade697).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2678   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2595      2595           
  Branches       659       659           
=========================================
  Hits          2595      2595           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rubiin rubiin changed the title Add Senegal (fr-SN) mobile phone validation feat(isMobilePhone): Add Senegal (fr-SN) mobile phone validation Mar 11, 2026
@rubiin rubiin requested review from WikiRik and Copilot March 28, 2026 13:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Senegal (fr-SN) support to isMobilePhone, filling a missing locale requested in #1761 and aligning code, tests, and documentation.

Changes:

  • Added fr-SN regex to src/lib/isMobilePhone.js for Senegal mobile number validation.
  • Added fr-SN valid/invalid test cases to the mobile phone locale test matrix.
  • Updated the README isMobilePhone locale list to include fr-SN.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/lib/isMobilePhone.js Adds fr-SN locale regex for Senegal mobile phone validation.
test/validators.test.js Adds test coverage for fr-SN valid/invalid phone number formats.
README.md Documents fr-SN as a supported isMobilePhone locale.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants